package com.elinkway.infinitemovies.bean;

import com.elinkway.infinitemovies.utils.MoviesConstant;
import com.lvideo.http.bean.LVideoBaseBean;

public class PlayRecord implements LVideoBaseBean {

    /**
     * 播放记录
     */
    private static final long serialVersionUID = 7798661047063447174L;
    private String name;
    private String url;
    private String aid;
    private String episode;
    private long time;
    private String vt;
    private String categoryName;
    private String porder;
    private String site;
    private String vid;
    private String isUpload = "0";
    private String poster = "";
    private int pageIndex;
    private int currentPagePosition;


    /**
     * 值为detail或website
     * 标识当前播放源为详情页请求的还是播放源列表请求的
     * --wtf--
     */
    private String requestType;

    /**
     * 播放进度
     */
    private long seekHistory = 0l;

    /**
     * request type 枚举值
     */
    public static final String REQUEST_TYPE_FROM_DETAIL = "detail";
    public static final String REQUEST_TYPE_FROM_WEBSITE = "website";


    public PlayRecord(String name, String url, String aid, String episode, String vt, String categoryName, long seekHistory, String porder, String site) {
        super();
        this.name = name;
        this.aid = aid;
        this.url = url;
        this.time = System.currentTimeMillis();
        this.episode = episode;
        this.setCategoryName(categoryName);
        this.setVt(vt);
        this.seekHistory = seekHistory;
        this.site = site;

    }

    public PlayRecord() {
        super();
        this.time = System.currentTimeMillis();
    }

    public void setCurrentPagePosition(int currentPagePosition) {
        this.currentPagePosition = currentPagePosition;
    }

    public void setPageIndex(int pageIndex) {
        this.pageIndex = pageIndex;
    }

    public int getPageIndex() {
        return pageIndex;
    }

    public int getCurrentPagePosition() {
        return currentPagePosition;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getUrl() {
        return url;
    }

    public void setUrl(String url) {
        this.url = url;
    }

    public static long getSerialversionuid() {
        return serialVersionUID;
    }

    public long getTime() {
        return time;
    }

    public void setTime(long time) {
        this.time = time;
    }

    public String getAid() {
        return aid;
    }

    public void setAid(String aid) {
        this.aid = aid;
    }

    public String getEpisode() {
        return episode;
    }

    public void setEpisode(Episode episode, String vt) {
        String ep_name = episode.getPorder();
        if (!(MoviesConstant.VT_MOVIE.equals(vt) || MoviesConstant.VT_TV.equals(vt) || MoviesConstant.VT_CARTOON
                .equals(vt))) {
            ep_name = episode.getPorder() + "-" + episode.getSubName();
        }
        this.episode = ep_name;
    }

    public void setEpisodeName(String ep_name) {
        this.episode = ep_name;
    }

    public String getDisplayName() {
        if ("".equals(episode)) {
            return this.name;
        }
        if (vt.equals(MoviesConstant.VT_CARTOON) || vt.equals(MoviesConstant.VT_TV)) {
            return this.name + "-" + String.format("第%s集", this.episode);
        } else if (vt.equals(MoviesConstant.VT_ZONGYI)) {
            return this.name + "-" + this.episode;
        } else {
            return this.name;
        }

    }

    public String getVt() {
        return vt;
    }

    public void setVt(String vt) {
        this.vt = vt;
    }

    public String getCategoryName() {
        return categoryName;
    }

    public void setCategoryName(String categoryName) {
        this.categoryName = categoryName;
    }

    public long getSeekHistory() {
        return seekHistory;
    }

    public void setSeekHistory(long seekHistory) {
        this.seekHistory = seekHistory;
    }

    public String getPorder() {
        return porder;
    }

    public void setPorder(String porder) {
        this.porder = porder;
    }

    public String getSite() {
        return site;
    }

    public void setSite(String site) {
        this.site = site;
    }

    public String getRequestType() {
        return requestType;
    }

    public void setRequestType(String requestType) {
        this.requestType = requestType;
    }

    public String getIsUpload() {
        return isUpload;
    }

    public String getVid() {
        return vid;
    }

    public void setVid(String vid) {
        this.vid = vid;
    }

    public void setIsUpload(String isUpload) {
        this.isUpload = isUpload;
    }

    public String getPoster() {
        return poster;
    }

    public void setPoster(String poster) {
        this.poster = poster;
    }
}
